package com.happyclub.pojo;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

/**
 * @author 高欢
 * @description TODO
 * @date 2019/4/4
 */
@Entity
@Table(name = "TB_USER", schema = "SCOTT")
@EntityListeners(AuditingEntityListener.class)
public class TbUser implements Serializable {
    private String userId;
    private String personalAlbumId;
    private String nickName;
    private String sex;
    private String telephone;
    private Time creatdtm;
    private Long islimit;
    private String headPortrait;
    private Long age;
    private String personalizedSignature;
    private String hobby;
    private String post;
    private String hometown;
    private String city;
    private String email;
    private Long integral;
    private String updatedtm;
    private String userPassword;
    private String solemelber;
    private Timestamp createdtm;

    private List<TbPhotoAlbum> photoAlbums;

    @Transient
    public List<TbPhotoAlbum> getPhotoAlbums() {
        return photoAlbums;
    }
    public void setPhotoAlbums(List<TbPhotoAlbum> photoAlbums) {
        this.photoAlbums = photoAlbums;
    }

    @Id
    @Column(name = "USER_ID")
    @GenericGenerator(name="idGenerator", strategy="uuid") //这个是hibernate的注解/生成32位UUID
    @GeneratedValue(generator="idGenerator")
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "PERSONAL_ALBUM_ID")
    public String getPersonalAlbumId() {
        return personalAlbumId;
    }

    public void setPersonalAlbumId(String personalAlbumId) {
        this.personalAlbumId = personalAlbumId;
    }

    @Basic
    @Column(name = "NICK_NAME")
    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Basic
    @Column(name = "SEX")
    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Basic
    @Column(name = "TELEPHONE",unique =true)
    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    @Basic
    @Column(name = "CREATDTM")
    public Time getCreatdtm() {
        return creatdtm;
    }

    public void setCreatdtm(Time creatdtm) {
        this.creatdtm = creatdtm;
    }

    @Basic
    @Column(name = "ISLIMIT")
    public Long getIslimit() {
        return islimit;
    }

    public void setIslimit(Long islimit) {
        this.islimit = islimit;
    }

    @Basic
    @Column(name = "HEAD_PORTRAIT")
    public String getHeadPortrait() {
        return headPortrait;
    }

    public void setHeadPortrait(String headPortrait) {
        this.headPortrait = headPortrait;
    }

    @Basic
    @Column(name = "AGE")
    public Long getAge() {
        return age;
    }

    public void setAge(Long age) {
        this.age = age;
    }

    @Basic
    @Column(name = "PERSONALIZED_SIGNATURE")
    public String getPersonalizedSignature() {
        return personalizedSignature;
    }

    public void setPersonalizedSignature(String personalizedSignature) {
        this.personalizedSignature = personalizedSignature;
    }

    @Basic
    @Column(name = "HOBBY")
    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    @Basic
    @Column(name = "POST")
    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    @Basic
    @Column(name = "HOMETOWN")
    public String getHometown() {
        return hometown;
    }

    public void setHometown(String hometown) {
        this.hometown = hometown;
    }

    @Basic
    @Column(name = "CITY")
    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @Basic
    @Column(name = "EMAIL")
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Basic
    @Column(name = "INTEGRAL")
    public Long getIntegral() {
        return integral;
    }

    public void setIntegral(Long integral) {
        this.integral = integral;
    }

    @Basic
    @Column(name = "UPDATEDTM")
    public String getUpdatedtm() {
        return updatedtm;
    }

    public void setUpdatedtm(String updatedtm) {
        this.updatedtm = updatedtm;
    }

    @Basic
    @Column(name = "USER_PASSWORD")
    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    @Basic
    @Column(name = "SOLEMELBER")
    public String getSolemelber() {
        return solemelber;
    }

    public void setSolemelber(String solemelber) {
        this.solemelber = solemelber;
    }

    @Basic
    @Column(name = "CREATEDTM")
    public Timestamp getCreatedtm() {
        return createdtm;
    }

    public void setCreatedtm(Timestamp createdtm) {
        this.createdtm = createdtm;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TbUser tbUser = (TbUser) o;
        return Objects.equals(userId, tbUser.userId) &&
                Objects.equals(personalAlbumId, tbUser.personalAlbumId) &&
                Objects.equals(nickName, tbUser.nickName) &&
                Objects.equals(sex, tbUser.sex) &&
                Objects.equals(telephone, tbUser.telephone) &&
                Objects.equals(creatdtm, tbUser.creatdtm) &&
                Objects.equals(islimit, tbUser.islimit) &&
                Objects.equals(headPortrait, tbUser.headPortrait) &&
                Objects.equals(age, tbUser.age) &&
                Objects.equals(personalizedSignature, tbUser.personalizedSignature) &&
                Objects.equals(hobby, tbUser.hobby) &&
                Objects.equals(post, tbUser.post) &&
                Objects.equals(hometown, tbUser.hometown) &&
                Objects.equals(city, tbUser.city) &&
                Objects.equals(email, tbUser.email) &&
                Objects.equals(integral, tbUser.integral) &&
                Objects.equals(updatedtm, tbUser.updatedtm) &&
                Objects.equals(userPassword, tbUser.userPassword) &&
                Objects.equals(solemelber, tbUser.solemelber) &&
                Objects.equals(createdtm, tbUser.createdtm);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, personalAlbumId, nickName, sex, telephone, creatdtm, islimit, headPortrait, age, personalizedSignature, hobby, post, hometown, city, email, integral, updatedtm, userPassword, solemelber, createdtm);
    }
}
